package com.digua.base.view

import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
import com.digua.base.util.CacheUtils

class DebugLinearLayout : LinearLayout {
    constructor(context: Context?) : super(context) {
        initUI()
    }

    constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs) {
        initUI()
    }

    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
        initUI()
    }

    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(context, attrs, defStyleAttr, defStyleRes) {
        initUI()
    }

    private fun initUI() {
        if (!CacheUtils.isDebug()) visibility = GONE
    }

    override fun setVisibility(visibility: Int) = super.setVisibility(if (CacheUtils.isDebug()) visibility else GONE)
}